package cn.tedu.tmall.admin.mall.pojo.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
public class CategoryAddNewParam implements Serializable {

    @ApiModelProperty(value = "类别名称", required = true, example = "茶叶")
    @NotNull(message = "新增类别失败，请提交类别名称！")
    @Pattern(regexp = "^(?:[\\u4e00-\\u9fa5]{1,6}|[a-zA-Z]{1}[a-zA-Z\\s]{1,15})$",
            message = "新增类别失败，类别名称必须是1~6个汉字组成，或由2~16个字母、空格组成，且空格不可以是第1个字符！")
    private String name;

    @ApiModelProperty(value = "父级类别", required = true, example = "0")
    @Range(message = "新增类别失败，父级类别ID值最小值为0！")
    private Long parentId;

    @ApiModelProperty("关键词列表")
    private String keywords;

    @ApiModelProperty(value = "排序序号", required = true, example = "0")
    @Range(max = 255, message = "新增类别失败，排序序号必须是0~255之间的数字！")
    private Integer sort;

    @ApiModelProperty("图标")
    private String icon;

    @ApiModelProperty(value = "是否启用", required = true, example = "1")
    @Range(max = 1, message = "新增类别失败，是否启用的值必须是0或1！")
    private Integer enable;

    @ApiModelProperty(value = "是否显示", required = true, example = "1")
    @Range(max = 1, message = "新增类别失败，是否显示的值必须是0或1！")
    private Integer isDisplay;

}
